/*
 * @: 
 * @Version: 1.0
 * @Autor: ziwei
 * @Date: 2021-11-01 10:41:02
 * @LastEditors: ziwei
 * @LastEditTime: 2021-11-01 17:20:23
 */
function thunk({getState,dispatch}) {
  return function(next) {//调用下一个中间件 next=store，原始的dispatch方法
    return function(action) {//这个就是改造后的dispatch
      if(typeof action === 'function'){
        return action(dispatch,getState)
      }
      return next(action);//next=store.dispatch
    }
  }
}

export default thunk